package com.zjitc.untils;

import redis.clients.jedis.Jedis;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/3 16:23
 * @description:
 */
public class RedisUtils {

  public static Jedis jedis = new Jedis();

  private static final Long TIME = Long.valueOf(1000*60*15);

  public static void add(String username, String token){
    jedis.set(username,token);
    outTime(username);
  }

  public static void delete(String username){
    jedis.del(username);
  }

  public static String find(String username){
    return jedis.get(username);
  }

  //失效时间
  public static void outTime(String username) {
    jedis.pexpire(username,TIME);
  }
}
